package pagelib;
import com.thoughtworks.selenium.*;


public class Page {
 
	static Selenium bo = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.credomobile.com");
	
	public void openTests()
	{
		bo.start();
		bo.windowMaximize();
	}
	
	public void clickVisibleLink(String link)
	{
		if(isElementVisible(link))
		{
			bo.click(link);
			bo.waitForPageToLoad("30000");
		}
	}
	
	public String getElementText(String element)
	{
		String text=null;
		if(isElementVisible(element))
		{
			text=bo.getText(element);
			return text;
		}
		else 
			return text;
	}
	public boolean isElementVisible (String element)
	{
		if(bo.isVisible(element))
			return(true);
		else
		{
			System.out.println("Element"+element+"is not visible and thus no value present");
			return(false);
		}
	}
}
